﻿using System;
using System.Linq;
using System.Collections.Generic;

namespace HashFoo.Rest.Common
{
    /// <summary>
    /// Defines a group of filters
    /// </summary>
    public class FilterSet
    {
        /// <summary>
        /// Creates a new <see cref="FilterSet"/>.
        /// </summary>
        public FilterSet()
        {
            BinaryOp = FilterBinaryOp.And;
        }

        /// <summary>
        /// The filter list that make up the set.
        /// </summary>
        public Filter[] Filters { get; set; }

        /// <summary>
        /// The binary operation (And, Or) to apply to the filters within the set.
        /// </summary>
        /// <remarks>
        /// This is pretty crappy right now -- it only allows for simple filters.  Maybe that's OK...  Eventually, we should create a LINQ provider... ?  DMF 20101006
        /// </remarks>
        public FilterBinaryOp BinaryOp { get; set; }
    }

    /// <summary>
    /// Filter binary operations, used for logical comparison of a group of filters.
    /// </summary>
    public enum FilterBinaryOp
    {
        /// <summary>
        /// And binary comparison op
        /// </summary>
        And,

        /// <summary>
        /// Or binary comparison op
        /// </summary>
        Or
    }
}